package org.jason.common.feign;

import cn.dev33.satoken.same.SaSameUtil;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.jason.common.constants.InternalTokenConstants;
import org.springframework.stereotype.Component;

@Component
public class FeignInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate requestTemplate) {
        requestTemplate.header(SaSameUtil.SAME_TOKEN, SaSameUtil.getToken())
                //添加只允许内部调用令牌
                .header(InternalTokenConstants.INTERNAL_TOKEN_HEAD, InternalTokenConstants.INTERNAL_TOKEN_VALUE);
    }
}
